<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>





</body>

<script>
    // 传统函数要调用才可以执行
    function a() {
        console.log('普通函数');
        console.log(1);
    }
    a();


    //立即执行函数
    //写法一    (function(){})()
    //写法二    (function(){}())

    (function(a) {
        console.log('写法一');
        console.log(1);
        console.log(a);
    })(1);


    (function(a) {
        console.log('写法二');
        console.log(1);
        console.log(a);
    }(1));
</script>

</html>